<!--回复列表-->
{include file="public/header"}

<div class="content">
	<div class="page-inner">
		<div class="row">
			<div class="col-md-12">
				<div class="card">
					<div class="card-header">
						<div class="card-title">智能回复</div>
					</div>
					<div class="card-body">
						<div class="card-sub">									
							以下为您配置的自定义回复列表&nbsp;&nbsp;&nbsp;
							排序：<a href="/huifu?paixu=a.id desc">降序</a>
							<button class="btn btn-primary btn-link" style="margit-right:0px;"><a href="/huifu_zn">添加智能回复</a></button>
						</div>
						<table class="table mt-3">
							<thead>
								<tr>
									<th scope="col">id</th>
									<th scope="col">关键词</th>
									<th scope="col">回复内容</th>
									<th scope="col">类型指令</th>
									<th scope="col">发布时间</th>
									<th scope="col">操作</th>
								</tr>
							</thead>
							<tbody>
							    {volist name="data.api" id="api"}
								<tr>
									<td>{$api.id}</td>
									<td>{$api.keywords}</td>
									<td>{$api.text}</td>
									<td>{$api.zh_name}&nbsp;&nbsp;{$api.api}</td>
									<td>{:date('Y-m-d H:i:s',$api.add_time)}</td>
									<td><button class="btn btn-danger btn-xs" onclick="delete_api({$api.id})">删除</button></td>
								</tr>
                                {/volist}
							</tbody>
						</table>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>

{include file="public/footer"}

<script>
    function delete_api(id){
        $.get('/delete_api',{'id':id},function(res){
              if(res.code>0){
                $.notify({
                	icon: 'flaticon-alarm-1',
                	title: '操作提示',
                	message: res.msg,
                },{
                	type: 'info',
                	placement: {
                		from: "bottom",
                		align: "right"
                	},
                	time: 1000,
                });
            }else{

               $.notify({
                	icon: 'flaticon-alarm-1',
                	title: '操作提示',
                	message: res.msg,
                },{
                	type: 'info',
                	placement: {
                		from: "bottom",
                		align: "right"
                	},
                	time: 1000,
                });
                setTimeout(function(){location.reload()},800);
            }
        },'json')
    }
</script>